import globals from "globals";
import pluginJs from "@eslint/js";
import tseslint from "typescript-eslint";
import pluginVue from "eslint-plugin-vue";
import withNuxt from "./.nuxt/eslint.config.mjs";
import prettier from "eslint-plugin-prettier";
import eslintConfigPrettier from "eslint-config-prettier";

export default withNuxt([
	{
		ignores: [".nuxt/", ".output/", "node_modules/"],
		rules: {
			"prettier/prettier": "error",
			"vue/multi-word-component-names": [
				"error",
				{
					ignores: ["index", "header", "footer"], //需要忽略的组件名
				},
			],
			"vue/no-multiple-template-root": "off",
		},
		plugins: {
			prettier,
		},
		languageOptions: {
			globals: {
				...globals.browser,
				...globals.node,
				...globals.es2021,
			},
			ecmaVersion: "latest",
			parser: tseslint.parser,
		},
	},
	pluginJs.configs.recommended,
	...tseslint.configs.recommended,
	...pluginVue.configs["flat/essential"],
	eslintConfigPrettier,
]);
